package com.ygq.springboot.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ygq.springboot.entity.Person;
import com.ygq.springboot.service.IPersonService;
import com.ygq.springboot.service.impl.PersonServiceImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-05-27
 */
@RestController
@RequestMapping("/person")
public class PersonController {
    @Resource
    private PersonServiceImpl service;

    @CrossOrigin
    @GetMapping("/index")
    public IPage<Person> index(String name, Integer sex, Integer currentNo){
        IPage<Person> page = new Page<>();
        page.setCurrent(currentNo);
        page.setSize(4);
        return service.findAll(name,sex,page);
    }

    @RequestMapping("/abc")
    public String abc(){
        return "Hello Word!!!";
    }
}
